﻿module Enferno.Public.Web.Components.Models {

    export class PromotionModel {

        public id: number;
        public header: string;
        public shortDescription: string;
        public description1: string;
        public description2: string;
        public discountCode: string;
        public name: string;
        public startDate: Date;
        public endDate: Date;
        public imageUrl: string;
        public requirementSeed: string;

        constructor();
        constructor(serverObjcet: any);
        constructor(serverObject?: any) {
            if (serverObject != null) {
                this.createServerFromObject(serverObject);
            }
        }

        private createServerFromObject(serverObject: any) {
            this.id = serverObject.id;
            this.header = serverObject.header;
            this.shortDescription = serverObject.shortDescription;
            this.description1 = serverObject.description1;
            this.description2 = serverObject.description2;
            this.discountCode = serverObject.discountCode;
            this.name = serverObject.name;
            this.startDate = new Date(serverObject.startDate);
            this.endDate = new Date(serverObject.endDate);
            this.imageUrl = serverObject.imageUrl;
            this.requirementSeed = serverObject.requirementSeed;
        }
    }
} 